package com.example.mvvmcoroutineexample

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsAnimationCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
import com.example.mvvmcoroutineexample.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {
    private lateinit var binding: ActivityMainBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
        val differingInsetsListner: RootViewDeferringInsetsCallback =
            RootViewDeferringInsetsCallback(
                persistentInsetTypes = WindowInsetsCompat.Type.systemBars(),
                deferredInsetTypes = WindowInsetsCompat.Type.ime(),
                orientationInsetTypes = WindowInsetsCompat.Type.displayCutout(),
                gestureInsetTypes = WindowInsetsCompat.Type.systemGestures(),
                this
            )
        ViewCompat.setWindowInsetsAnimationCallback(binding.root, differingInsetsListner)
        ViewCompat.setOnApplyWindowInsetsListener(binding.root, differingInsetsListner)
    }
}